//
//  AMapNavigationViewController.m
//  嘀嘀拍
//
//  Created by 陈一航 on 16/3/3.
//  Copyright (c) 2016年 wangjia_01. All rights reserved.
//

#import "AMapNavigationViewController.h"

#import <AudioToolbox/AudioToolbox.h>

@interface AMapNavigationViewController ()
//<AMapNaviViewControllerDelegate,MAMapViewDelegate,AMapNaviManagerDelegate>
{

  //  AMapNaviPoint *_endPoint;
    //地图视图
   // MAUserLocation *_userLocation;
    NSMutableArray *_poiAnnotations;

}
@property (weak, nonatomic) IBOutlet UIView *mapContainer;
//@property (nonatomic, strong) AMapNaviViewController *naviViewController;

//@property (nonatomic,strong)AMapNaviManager *manager;
//@property (nonatomic,strong)MAMapView * mapView;


@end

@implementation AMapNavigationViewController

//- (void)viewDidLoad {
//    [super viewDidLoad];
//    //[self  initNaviViewController] ;
//    // Do any additional setup after loading the view from its nib.
////    [AMapNaviServices sharedServices].apiKey =@"a1c1e06dbc7a2fb9cf7259f2df43ee93";
////    [MAMapServices sharedServices].apiKey =@"a1c1e06dbc7a2fb9cf7259f2df43ee93";
//    
//    [self initNavManager];
//    [self initNaviViewController];
//    [self initMapView];
//    
//}
//
//
////初始化地图导航管理器
//- (void)initNavManager
//{
//    if (!self.manager) {
//        self.manager=[[AMapNaviManager alloc] init];
//    }
//    [self .manager setDelegate:self];
//}
//
////初始化地图
//- (void)initMapView
//{
//    if (_mapView == nil)
//    {
//        _mapView = [[MAMapView alloc] initWithFrame:self.mapContainer.bounds];
//    }
//    
//    [_mapView setDelegate:self];
//    [_mapView setShowsUserLocation:YES];
//    [_mapView setShowsCompass:NO];
//   //设置为当前位置  [_mapView setRegion:MACoordinateRegionMake(_userLocation, MACoordinateSpanMake(33.00, 33.00)) animated:YES];
//    [_mapView setHeadingFilter:10];
//
//    [self.mapContainer addSubview:_mapView];
//}
//
//
//- (void)initNaviViewController
//{
//    if (self.naviViewController == nil)
//    {
//        _naviViewController = [[AMapNaviViewController  alloc] initWithMapView:_mapView delegate:self];
//    }
//    
//    [self.naviViewController setDelegate:self];
//}
//
//#pragma mark - AmapViewDelegate
//
//- (void)mapView:(MAMapView *)mapView didUpdateUserLocation:(MAUserLocation *)userLocation updatingLocation:(BOOL)updatingLocation
//{
//    if (updatingLocation) {
//        _userLocation=userLocation;
//        [_mapView setCenterCoordinate:_userLocation.coordinate];
//    }
//
//}
//
//- (void)mapView:(MAMapView *)mapView annotationView:(MAAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control
//{
//
//    if ([view.annotation isKindOfClass:[MAPointAnnotation class]])
//    {
//        MAPointAnnotation *annotation = (MAPointAnnotation *)view.annotation;
//        
//        _endPoint = [AMapNaviPoint locationWithLatitude:annotation.coordinate.latitude
//                                              longitude:annotation.coordinate.longitude];
//        [self startEmulatorNavi];
//    }
//
//    
//}
//
//
//- (MAAnnotationView *)mapView:(MAMapView *)mapView viewForAnnotation:(id<MAAnnotation>)annotation
//{
//    if ([annotation isKindOfClass:[MAPointAnnotation class]])
//    {
//        static NSString *pointReuseIndetifier = @"poiIdentifier";
//        MANaviAnnotationView *annotationView = (MANaviAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:pointReuseIndetifier];
//        
//        if (annotationView == nil)
//        {
//            annotationView = [[MANaviAnnotationView alloc] initWithAnnotation:annotation
//                                                              reuseIdentifier:pointReuseIndetifier];
//        }
//        annotationView.canShowCallout = YES;
//        annotationView.draggable = NO;
//        
//        return annotationView;
//    }
//    
//    return nil;
//}
//
//
//#pragma mark - Actions
//
//- (void)startEmulatorNavi
//{
//    [self calculateRoute];
//}
//
//- (void)calculateRoute
//{
//    NSArray *endPoints = @[_endPoint];
//    
//    [self.manager calculateDriveRouteWithEndPoints:endPoints wayPoints:nil drivingStrategy:0];
//}
//
//
//
//
//#pragma mark - AMapNaviManager Delegate
//
//- (void)naviManager:(AMapNaviManager *)naviManager error:(NSError *)error
//{
//    NSLog(@"error:{%@}",error.localizedDescription);
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager didPresentNaviViewController:(UIViewController *)naviViewController
//{
//    NSLog(@"didPresentNaviViewController");
//  
//    [self.manager startEmulatorNavi];
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager didDismissNaviViewController:(UIViewController *)naviViewController
//{
//    NSLog(@"didDismissNaviViewController");
//}
//
//- (void)naviManagerOnCalculateRouteSuccess:(AMapNaviManager *)naviManager
//{
//    NSLog(@"OnCalculateRouteSuccess");
//    
//    if (self.naviViewController == nil)
//    {
//        [self initNaviViewController];
//    }
//    
//    [self.manager presentNaviViewController:self.naviViewController animated:YES];
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager onCalculateRouteFailure:(NSError *)error
//{
//    NSLog(@"onCalculateRouteFailure");
//}
//
//- (void)naviManagerNeedRecalculateRouteForYaw:(AMapNaviManager *)naviManager
//{
//    NSLog(@"NeedReCalculateRouteForYaw");
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager didStartNavi:(AMapNaviMode)naviMode
//{
//    NSLog(@"didStartNavi");
//}
//
//- (void)naviManagerDidEndEmulatorNavi:(AMapNaviManager *)naviManager
//{
//    NSLog(@"DidEndEmulatorNavi");
//}
//
//- (void)naviManagerOnArrivedDestination:(AMapNaviManager *)naviManager
//{
//    NSLog(@"OnArrivedDestination");
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager onArrivedWayPoint:(int)wayPointIndex
//{
//    NSLog(@"onArrivedWayPoint");
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager didUpdateNaviLocation:(AMapNaviLocation *)naviLocation
//{
//    //    NSLog(@"didUpdateNaviLocation");
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager didUpdateNaviInfo:(AMapNaviInfo *)naviInfo
//{
//    //    NSLog(@"didUpdateNaviInfo");
//}
//
//- (BOOL)naviManagerGetSoundPlayState:(AMapNaviManager *)naviManager
//{
//    return 0;
//}
//
//- (void)naviManager:(AMapNaviManager *)naviManager playNaviSoundString:(NSString *)soundString soundStringType:(AMapNaviSoundType)soundStringType
//{
//    NSLog(@"playNaviSoundString:{%ld:%@}", (long)soundStringType, soundString);
//    
//    if (soundStringType == AMapNaviSoundTypePassedReminder)
//    {
//        //用系统自带的声音做简单例子，播放其他提示音需要另外配置
//        AudioServicesPlaySystemSound(1009);
//    }
//    
//}
//
//- (void)naviManagerDidUpdateTrafficStatuses:(AMapNaviManager *)naviManager
//{
//    NSLog(@"DidUpdateTrafficStatuses");
//}
//
//
//
//#pragma mark - AManNaviViewController Delegate
//
//- (void)naviViewControllerCloseButtonClicked:(AMapNaviViewController *)naviViewController
//{
//    
//    
//    [self.manager stopNavi];
//    
//    [self.manager dismissNaviViewControllerAnimated:YES];
//}
//
//- (void)naviViewControllerMoreButtonClicked:(AMapNaviViewController *)naviViewController
//{
//    if (self.naviViewController.viewShowMode == AMapNaviViewShowModeCarNorthDirection)
//    {
//        self.naviViewController.viewShowMode = AMapNaviViewShowModeMapNorthDirection;
//    }
//    else
//    {
//        self.naviViewController.viewShowMode = AMapNaviViewShowModeCarNorthDirection;
//    }
//}
//
//- (void)naviViewControllerTurnIndicatorViewTapped:(AMapNaviViewController *)naviViewController
//{
//    [self.manager readNaviInfoManual];
//}
//
//



@end
